import Fluent
import Vapor

func routes(_ app: Application) throws {
  
    // 例如，确保 apple-app-site-association 文件以 application/json 类型提供
    app.get(".well-known", "apple-app-site-association") { req -> EventLoopFuture<Response> in
        let path = app.directory.publicDirectory + ".well-known/apple-app-site-association"
        let response = req.fileio.streamFile(at: path, advancedETagComparison: false)
        return response.map { result in
            result.headers.contentType = .json
            return result
        }
    }
    /*
    在 Application 配置中注册它
    这样，您就可以通过以下 API 端点访问用户的 CRUD 操作 
    */
    try app.register(collection: UserController())
    
    try app.register(collection: LoginController())
    
    try app.register(collection: StoreController())
  
    try app.register(collection: ListController())

}
